{template '_header'}
<div class='page-heading'><h2>满额包邮设置</h2></div>
 
    <form id="dataform"    {ifp 'sale.enoughfree'}action="" method="post"{/if} class="form-horizontal form-validate">
      
          
          <div class="panel panel-default" >
         <div class="panel-body">
        <div class="col-sm-9 col-xs-12">
            <h4>满额包邮</h4>
            <span> 开启满包邮, 订单总金额超过多少可以包邮</span>
        </div>
        <div class="col-sm-2 pull-right" style="padding-top:10px;text-align: right" >
            {ifp 'sale.enoughfree'}
	<input type="checkbox" class="js-switch" name="data[enoughfree]" value="1" {if $data['enoughfree']==1}checked{/if} />
               {else}
               {if $data['enoughfree']==1}
               <span class='text-success'>开启</span>
               {else}
               <span class='text-default'>关闭</span>
               {/if}
               {/if}
        </div>
 </div>  
 
                <div id='enoughfree'  {if empty($data['enoughfree'])}style="display:none"{/if}>
                  <div class="form-group">
                       <label class="col-sm-2 control-label">单笔订单满</label>
                       <div class="col-sm-9 col-xs-12">
                           {ifp 'sale.enoughfree'}
                          <div class='input-group'>
                                   <input type="text" name="data[enoughorder]"  value="{$data['enoughorder']}" class="form-control" />
                                   <span class='input-group-addon'>元</span>
                           </div>
                           <span class='help-block'>如果开启满额包邮，设置0为全场包邮</span>
                           {else}
                           <div class='form-control-static'>{if empty($data['enoughmoney'])}全场包邮{else}订单金额满{$data['enoughmoney']}元包邮{/if}</div>
                           {/if}
                       </div>
                   </div> 
                
                
                  <div class="form-group">
                       <label class="col-sm-2 control-label">不参加的地区</label>
                       <div class="col-sm-9 col-xs-12">
                           {ifp 'sale.enoughfree'}
                           <div id="areas" class="form-control-static">{$data['enoughareas']}</div>
                           <a href="javascript:;" class="btn btn-default" onclick="selectAreas()">选择地区</a>
                           <input type="hidden" id='selectedareas' name="data[enoughareas]" value="{$data['enoughareas']}" />
                           {else}
                           <div class='form-control-static'>{$data['enoughareas']}</div>
                           {/if}
                       </div>
                   </div> 
          </div>
        </div>
          
				 
                   {ifp 'sale.enoughfree'}
                <div class="form-group"></div>
                   <div class="form-group">
                            
                           <div class="col-sm-9 col-xs-12">
                                 <input type="submit"  value="保存设置" class="btn btn-primary"/>
                                 
                           </div>
                    </div>
                {/if}
 
     
    </form>
 
<script language='javascript'>
  
                $(function () {
                    $(":checkbox[name='data[enoughfree]']").click(function () {
                        if ($(this).prop('checked')) {
                            $("#enoughfree").show();
                        }
                        else {
                            $("#enoughfree").hide();
                        }
                    })
                   

                })
         
             
	</script>
{template 'shop/selectareas'}
{template '_footer'}
